﻿using System;
using System.Linq.Expressions;

namespace Relocation.Data
{
	public partial class relocatees_view
	{
		static public string GetPropName(Expression<Func<relocatees_view, object>> expr)
		{
			switch (expr.Body.NodeType)
			{
				case ExpressionType.MemberAccess:
					return ((MemberExpression)expr.Body).Member.Name;
				case ExpressionType.Convert:
					return ((MemberExpression)((UnaryExpression)expr.Body).Operand).Member.Name;
				default:
					return null;
			}
		}

	}
}
